var file = '../talk/talk'
var app = getApp()
Page({

    data: {
        good: [], 
      },

    navigateTo: function() {
    wx.navigateTo({
      //传递参数方式向get请求拼接参数一样
      url:  file + '?phone=18939571&password=1992',
      success: function(res) {
        console.log(res)
      },
      fail: function(err) {
        console.log(err)
      }

    })
  },
    // 页面初始化 options为页面跳转所带来的参数
  onLoad:function(options){

     //动态获取食品单页面数据
     this.set
     var that = this;
     wx.showToast({
        title: '加载中',
        icon: 'Loading',
        duration: 500,
    },
    wx.request ({
      url: 'https://canyin.api.yanxishe.cc/web/api/food/1',
      data: {},
      method: 'GET', 
      header: {"Content-Type":"json"},
      success: function(res){
        wx.hideToast()
        console.log(res);
        that.setData({good:res.data.data});
        console.log(res.data.data);
      },
      fail: function() {
        console.log("商家不在家!");
      },
      complete: function() {
        console.log("请求成功!");
      }
    })
    )

  },
})